#include <iostream>
#include "../../common/detail.hpp"
#include "../../client/rpc_client.hpp"

int main(){
    myrpc::initLoggers();

    auto pub_client = std::make_shared<myrpc::client::TopicClient>("127.0.0.1", 28080);
    std::string topic_name = "HELLO";
    bool ret = pub_client->topicCreate(topic_name);
    if (ret == false){
        return 1;
    }
    for (int i = 0; i < 10; i++){
        std::string msg = "hello world-" + std::to_string(i);
        pub_client->topicPublish(topic_name, msg);
    }
    std::this_thread::sleep_for(std::chrono::seconds(10));
    pub_client->shutdown();
    mylog::shutdown();
    return 0;
}